package com.atguigu.helloknife4j.controller;

import com.atguigu.helloknife4j.pojo.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
@Tag(name="用户控制器")
public class UserController {

    @Operation(summary = "根据用户id获取用户详情")
    @GetMapping("/{id}")
    public User getUserById(@Parameter(name="用户id") @PathVariable("id") Integer userId){
        return new User(userId , "鸠摩智","吐蕃");
    }

    @Operation(summary = "新增用户")
    @PostMapping
    public User addUser(@Parameter(name="用户请求体") @RequestBody User user){
        return user;
    }

}
